package cn.com.joycode.nimble.web.spring;

import cn.com.joycode.nimble.core.message.NbMsg;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author Max Woods
 * @since 1.0
 */

@Slf4j
public abstract class AbstractRestController {

    @ExceptionHandler(RuntimeException.class)
    private NbMsg runtimeExceptionHandler(RuntimeException runtimeException) {
        return onRuntimeException(runtimeException);
    }

    abstract protected NbMsg onRuntimeException(RuntimeException runtimeException);
}
